package com.example.myapplication.databinding.bean.vegetable;

import android.graphics.Color;
import android.widget.TextView;

import androidx.databinding.BindingAdapter;

/**
 * Created by xiaolong on 2022/1/2 8:59 下午
 * email：xinxiaolong123@foxmail.com
 */
public class Vegetable {

    private String name;
    private double price;
    private String color;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    @BindingAdapter({"app:bindColor"}) //notice the bindColor custom attribute
    public static void setTextColor(TextView view, String color) {
        if("green".equals(color))
            view.setTextColor(Color.parseColor("#63f421"));

    }

}
